<template>
  <div id="camerasModal">
    <fwb-modal id="modal" size="md" @close="close">
      <template #header>
        <div
          class="flex items-center text-[14px] s4k:text-[28px] s4k:ml-5 font-medium leading-[17.5px]"
          style="color: #9ca3af"
        >Edit Camera Info</div>
      </template>
      <template #body>
        <div style="border: 1px 0 1px 0 solid #4b5563;">
          <h1
            class="leading-[20px] text-[20px] s4k:text-[40px] font-bold text-[var(--theme-font-color)]"
          >Edit Camera Info</h1>
          <div
            class="text-[14px] font-medium text-[var(--theme-font-color)] mt-6 mb-3 s4k:text-[28px] s4k:mt-12 s4k:mb-6"
            style="color: #9ca3af"
          >Camera Info</div>
          <div
            class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4"
          >Camera ID</div>
          <fwb-input
            v-model="address"
            placeholder
            id="address"
            class="text-[14px] s4k:text-[28px]"
            style="width: 100%"
          ></fwb-input>
          <div
            class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4"
          >Location</div>
          <fwb-input
            v-model="address"
            placeholder
            id="address"
            class="text-[14px] s4k:text-[28px]"
            style="width: 100%"
          ></fwb-input>
          <div class="flex items-center justify-between">
            <div class="w-[257px] s4k:w-[514px]">
              <div
                class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
              >Brand</div>
              <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
            </div>
            <div class="w-[257px] s4k:w-[514px]">
              <div
                class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
              >Model</div>
              <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
            </div>
          </div>
          <div
            class="flex items-center justify-between pb-6"
            style="border-bottom:1px solid var(--grid);"
          >
            <div class="w-[257px] s4k:w-[514px]">
              <div
                class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
              >Transfer Protocol</div>
              <fwb-dropdown :text="textUrl" id="dropdownMode">
                <fwb-list-group>
                  <fwb-list-group-item @click.stop="clickTextUrl('POST')" class="focus:">POST</fwb-list-group-item>
                  <fwb-list-group-item @click="clickTextUrl('PUT')">PUT</fwb-list-group-item>
                  <fwb-list-group-item @click="clickTextUrl('GET')">GET</fwb-list-group-item>
                  <fwb-list-group-item @click="clickTextUrl('Hearder')">Hearder</fwb-list-group-item>
                </fwb-list-group>
              </fwb-dropdown>
            </div>
            <div class="w-[257px] s4k:w-[514px]">
              <div
                class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
              >Port</div>
              <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
            </div>
          </div>
          <!-- Network Settings -->
          <div class="pb-6" style="border-bottom:1px solid var(--grid);">
            <div
              class="text-[14px] font-[800px] text-[var(--theme-font-color)] mt-6 mb-4 s4k:text-[28px] s4k:mt-12 s4k:mb-8"
              style="color:#9CA3AF;"
            >Network Settings</div>
            <div
              class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4"
            >IP address</div>
            <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
            <div class="flex items-center justify-between">
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Subnet Mask</div>
                <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
              </div>
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Gateway</div>
                <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
              </div>
            </div>
          </div>
          <!-- Mainstream -->
          <div class="pb-6" style="border-bottom:1px solid var(--grid);">
            <div
              class="text-[14px] font-[800px] text-[var(--theme-font-color)] mt-6 s4k:text-[28px] s4k:mt-12"
              style="color:#9CA3AF;"
            >Mainstream</div>
            <div class="flex items-center justify-between">
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Encoder</div>
                <!-- <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input> -->
                <fwb-dropdown text="H264" id="dropdown">
                  <fwb-list-group>
                    <fwb-list-group-item @click.stop="clickTextUrl('POST')" class="focus:">H264</fwb-list-group-item>
                    <fwb-list-group-item @click="clickTextUrl('PUT')">H265</fwb-list-group-item>
                  </fwb-list-group>
                </fwb-dropdown>
              </div>
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Gateway</div>
                <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
              </div>
            </div>
            <div class="flex items-center justify-between">
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Bit Rate (mps)</div>
                <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
              </div>
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Resolution</div>
                <fwb-dropdown text="720 x 240 px" id="dropdown">
                  <fwb-list-group>
                    <fwb-list-group-item
                      @click.stop="clickTextUrl('POST')"
                      class="focus:"
                    >720 x 240 px</fwb-list-group-item>
                    <fwb-list-group-item @click="clickTextUrl('PUT')">720 x 240 px</fwb-list-group-item>
                  </fwb-list-group>
                </fwb-dropdown>
              </div>
            </div>
          </div>
          <!-- Substream -->
          <div class="pb-6" style="border-bottom:1px solid var(--grid);">
            <div
              class="text-[14px] font-[800px] text-[var(--theme-font-color)] mt-6 s4k:text-[28px] s4k:mt-12"
              style="color:#9CA3AF;"
            >Substream</div>
            <div class="flex items-center justify-between">
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Encoder</div>
                <!-- <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input> -->
                <fwb-dropdown text="H264" id="dropdown">
                  <fwb-list-group>
                    <fwb-list-group-item @click.stop="clickTextUrl('POST')" class="focus:">H264</fwb-list-group-item>
                    <fwb-list-group-item @click="clickTextUrl('PUT')">H265</fwb-list-group-item>
                  </fwb-list-group>
                </fwb-dropdown>
              </div>
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Gateway</div>
                <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
              </div>
            </div>
            <div class="flex items-center justify-between">
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Bit Rate (mps)</div>
                <fwb-input v-model="address" placeholder id="address" style="width: 100%"></fwb-input>
              </div>
              <div class="w-[257px] s4k:w-[514px]">
                <div
                  class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
                >Resolution</div>
                <fwb-dropdown text="720 x 240 px" id="dropdown">
                  <fwb-list-group>
                    <fwb-list-group-item
                      @click.stop="clickTextUrl('POST')"
                      class="focus:"
                    >720 x 240 px</fwb-list-group-item>
                    <fwb-list-group-item @click="clickTextUrl('PUT')">720 x 240 px</fwb-list-group-item>
                  </fwb-list-group>
                </fwb-dropdown>
              </div>
            </div>
          </div>
          <div>
            <div
              class="text-[14px] font-medium text-[var(--theme-font-color)] mt-6 mb-3 s4k:text-[28px] s4k:mt-12 s4k:mb-6"
              style="color: #9ca3af"
            >URLs</div>
            <div
              class="text-[12px] font-medium text-[var(--theme-font-color)] mt-4 mb-2 s4k:text-[24px] s4k:mt-8 s4k:mb-4 leading-[18px]"
            >3D Live URl</div>
            <fwb-input
              v-model="address"
              placeholder
              id="address"
              class="text-[14px] s4k:text-[28px]"
              style="width: 100%"
            ></fwb-input>
          </div>
        </div>
      </template>
      <template #footer>
        <div class="flex justify-start">
          <button
            id="dropdownDefaultButton"
            data-dropdown-toggle="dropdown"
            class="w-[160px] h-[41px] s4k:w-[320px] s4k:h-[82px] s4k:text-[28px] s4k:px-10 s4k:py-5 text-[var(--theme-font-color)] bg-[#1C64F2] focus:ring-4 font-medium rounded-lg text-[14px] px-5 py-2.5 text-center inline-flex items-center justify-center"
            type="button"
            @click="isAddCamerShow = !isAddCamerShow"
          >
            <span class="text-md text-white font-Medium font-[400] s4k:text-[28px]">Add Camera</span>
          </button>
          <button
            id="dropdownDefaultButton"
            data-dropdown-toggle="dropdown"
            class="w-[160px] h-[41px] s4k:w-[320px] s4k:h-[82px] s4k:text-[28px] s4k:px-10 s4k:py-5 s4k:ml-4 ml-2 text-white bg-[var(--grid)] focus:ring-4 font-medium rounded-lg text-[14px] px-5 py-2.5 text-center inline-flex items-center justify-center"
            type="button"
            @click="isAddCamerShow = !isAddCamerShow"
          >
            <span class="text-md text-white font-Medium font-[400] s4k:text-[28px]">Cancel</span>
          </button>
        </div>
      </template>
    </fwb-modal>
  </div>
</template>
<script>
import { onMounted, reactive, ref, defineEmits } from "vue";
import {
  FwbInput,
  FwbButton,
  FwbModal,
  FwbDropdown,
  FwbListGroup,
  FwbListGroupItem
} from "flowbite-vue";
import { defineComponent } from "vue";

export default defineComponent({
  name: "ModalManually"
});
</script>
<script setup>
const addressOptional = ref("");
const address = ref("");
const account = ref("");
const password = ref("");
const cameraIndex = ref(1);
const cameraList = ref([]);
const isAddCamerShow = ref(false);
const isAnimation = ref(false);
const iscamerTable = ref(false);
const tableCount = ref(0);
const textUrl = ref("TCP");
//
const Fun = defineEmits(["close"]);

const close = () => {
  Fun("close", false);
};
//
const clickTextUrl = val => {
  textUrl.value = val;
};
</script>
<style lang="scss" scoped>
#modal {
  :deep(.max-w-md) {
    width: 576px !important;
    height: 847px !important;
    max-width: 1536px !important;
    box-shadow: 0px 4px 6px 0px #0000000d;
    box-sizing: border-box;
    button {
      cursor: pointer;

      &:hover {
        //background: var(--theme);
      }

      svg {
        color: #6B7280;
      }
    }
  }
  :deep(.max-w-md > .shadow) {
    width: 576px !important;
    height: 847px !important;
    box-shadow: 0px 4px 6px 0px #0000000d;
  }
  :deep(.max-w-md > .shadow .p-6:nth-of-type(2)) {
    max-height: 706px;
    padding: 32px 20px 20px 20px !important;
    box-sizing: border-box;
    overflow-y: auto;
    border-top: 1px solid var(--grid);
  }
  :deep(.bg-white) {
    border: 1px solid var(--grid);
    background-color: var(--theme) !important;
  }
  :deep(.max-w-md > .shadow .p-6:nth-of-type(3)) {
    padding: 20px !important;
    border-top: 1px solid var(--grid);
  }
  :deep(.border-b) {
    height: 33px;
    padding: 16px 10px 12px 20px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  :deep(.max-w-md > .shadow > .p-6)::-webkit-scrollbar {
    width: 4px;
    height: 151.83px;
  }
  :deep(.max-w-md > .shadow > .p-6)::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: var(--grid);
  }
  :deep(.max-w-md > .shadow > .p-6)::-webkit-scrollbar-track {
    width: 4px;
    height: 706px;
    background: var(--theme-right);
  }
}
#address {
  padding: 0;
  :deep(input) {
    padding: 8px 16px;
    height: 35px;
    background-color: var(--theme);
    border: solid var(--grid) 1px;
    font-size: 14px;
    color: var(--theme-font-color);
    box-sizing: border-box;
    &:focus {
      box-shadow: inset 0 0;
    }
  }
}
button {
  box-shadow: none !important;
}
@media screen and (min-width: 2560px) {
  #camerasModal {
    :deep(.max-w-md) {
      transform: scale(1.3);
      #dropdown{
        .divide-y{
          bottom: -72px !important;
        }
      }
      #dropdownMode{
        .divide-y{
          bottom: -140px !important;
        }
      }
    }
  }
}
@media screen and (min-width: 3840px) {
  #modal {
    :deep(input) {
      padding: 8px 16px;
      height: 68px;
      background-color: var(--theme);
      border: solid var(--grid) 1px;
      font-size: 28px;
      font-family: Medium;
      color: var(--theme-font-color);
      box-sizing: border-box;

      &:focus {
        box-shadow: inset 0 0;
      }
    }
  }
}
#dropdown,#dropdownMode {
  :focus {
    box-shadow: none;
  }
  :deep(button) {
    width: 257px;
    height: 37px;
    border: 1px solid var(--grid);
    background-color: var(--theme) !important;
    box-sizing: border-box;
    cursor: pointer;
    // :before {
    //   content: "";
    // }
    // span {
    //   display: none;
    // }
    svg{
      position: absolute;
      right: 3%;
      top: 50%;
      transform: translateY(-50%);
      width: 15px;
      height: 15px;
      color: var(--svg);
    }
  }
  :deep(.rounded) {
    overflow: hidden;
  }
  :deep(.ml-2) {
    display: flex;
    align-items: center;
  }
  :deep(ul) {
    width: 257px;
    color: var(--theme-font-color);
    border: none !important;
    border-radius: 0;
    li:hover {
      cursor: pointer !important;
      background-color: var(--grid) !important;
    }
  }
  :deep(li) {
    width: 257px;
    box-sizing: border-box;
    font-size: 14px;
    display: inline-block;
    border-bottom: 1px solid var(--grid);
  }
  :deep(li):last-child {
    border-bottom: none;
  }
  :deep(span) {
    display: inline-block;
    width: 200px;
    color: var(--theme-font-color);
    font-size: 14px !important;
    text-align: left;
    font-weight: normal;
  }
}
@media screen and (min-width: 3840px) {
  #modal {
    :deep(.max-w-md) {
      transform: scale(1);
      width: 1152px !important;
      height: 1694px !important;
      max-width: 1536px !important;
      box-shadow: 0px 8px 12px 0px #0000000d;
      box-sizing: border-box;
    }
    :deep(.max-w-md > .shadow) {
      width: 1152px !important;
      height: 1694px !important;
      box-shadow: 0px 8px 12px 0px #0000000d;
    }
    :deep(.max-w-md > .shadow .p-6:nth-of-type(2)) {
      max-height: 1412px;
      padding: 64px 40px 40px 40px !important;
      box-sizing: border-box;
      overflow-y: auto;
      border-top: 2px solid var(--grid);
    }
    :deep(.bg-white) {
      border: 2px solid var(--grid);
      background-color: var(--theme) !important;
    }
    :deep(.max-w-md > .shadow .p-6:nth-of-type(3)) {
      padding: 40px !important;
      border-top: 2px solid var(--grid);
    }
    :deep(.border-b) {
      height: 66px;
      padding: 32px 20px 24px 40px !important;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    :deep(.max-w-md > .shadow > .p-6)::-webkit-scrollbar {
      width: 8px;
      height: 300.83px;
    }
    :deep(.max-w-md > .shadow > .p-6)::-webkit-scrollbar-thumb {
      border-radius: 99px;
      background: var(--grid);
    }
    :deep(.max-w-md > .shadow > .p-6)::-webkit-scrollbar-track {
      width: 4px;
      height: 1412px;
      background: var(--theme-right);
    }
    :deep(.w-5) {
      width: 40px;
      height: 40px;
    }
  }
  #dropdown, #dropdownMode {
    :focus {
      box-shadow: none;
    }
    :deep(button) {
      width: 514px;
      height: 68px;
      padding: 16px 32px;
      border: 1px solid var(--grid);
      background-color: var(--theme) !important;
      cursor: pointer;
      // :before {
      //   content: "";
      // }
      // span {
      //   display: none;
      // }
      svg {
        width: 32px;
        height: 32px;
      }
    }
    :deep(.ml-2) {
      display: flex;
      align-items: center;
    }
    :deep(.rounded) {
      overflow: hidden;
    }
    :deep(ul) {
      width: 514px;
      color: var(--theme-font-color);
      border: none !important;
      // border-radius: 16px;
      border-radius: 0;
      li:hover {
        cursor: pointer !important;
        background-color: var(--grid) !important;
      }
    }
    :deep(li) {
      width: 514px;
      height: 68px;
      box-sizing: border-box;
      font-size: 28px;
      display: inline-block;
      border-bottom: 1px solid var(--grid);
    }
    :deep(li):last-child {
      border-bottom: none;
    }
    :deep(span) {
      display: inline-block;
      width: 400px;
      font-size: 28px !important;
      text-align: left;
      font-weight: normal;
    }
  }
  #camerasModal {
    :deep(.max-w-md) {
      .p-4{
        padding-left: 10px !important;
        padding-right: 20px !important;
      }
      #dropdown{
        .divide-y{
          bottom: -144px !important;
        }
      }
      #dropdownMode{
        .divide-y{
          bottom: -280px !important;
        }
      }
    }
  }
}
</style>
